package test.nettys.fif;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;

/**
 * @Author wangshaopeng
 * @Date 2021/7/6
 */
public class MyServer {

    public static void main(String[] args) throws InterruptedException {

        NioEventLoopGroup boos = new NioEventLoopGroup();
        NioEventLoopGroup worker = new NioEventLoopGroup();

        ServerBootstrap bootstrap = new ServerBootstrap();
        bootstrap.group(boos,worker)
                .handler(new LoggingHandler(LogLevel.INFO))
                .channel(NioServerSocketChannel.class)
                .childHandler(new WebSocketServerInitlizer());


        ChannelFuture future = bootstrap.bind(8899).sync();
        future.channel().closeFuture().sync();

    }
}
